// HOW TO ADD NEW COLOR TO THE TABLE:

// 1. Add the table ceel in the same format as existing cells

// 2. Add the new color to the colors array below. ORDER IS IMPORTANT (first row colors, second row colors etc.)

function m5ColorClicked(obj_cell, color, collection_name, output_id_name, hidden_id_name)

{

 colors = new Array('dark red','red','dark orange','orange','yellow','lemon yellow','alien green','lime green','green','dark green','aquamarine','dark aquamarine','cyan blue','baby blue','royal blue','blue','black','dark gray','gray','silver gray','light gray','white','brown','golden brown','maroon','violet red','fuschia','violet','purple','violet blue','slate blue','navy blue');

	number_of_cells = colors.length;

	// CHANGE THE STATE OF THE CELL
	if (obj_cell.innerHTML == '&nbsp;') {
		obj_cell.innerHTML = '<img src="/images/order_checked_color.gif" width="14" height="19">';
	} else {
		obj_cell.innerHTML = '&nbsp;';
	}
	// SET THE HIDDEN FIELD WITH COLOR CODES

	// SET THE LABEL WITH DESCRIPTIVE FIELD
	str_hidden_field = "";
	str_label_output = "";

	for (i=1; i<=number_of_cells; i++) {
		cell_id = collection_name + '_' + i;
		if (document.getElementById(cell_id).innerHTML != '&nbsp;') {
			if (str_hidden_field == '') {
                str_hidden_field = document.getElementById(cell_id).bgColor;
			} else {
                str_hidden_field = str_hidden_field + ',' + document.getElementById(cell_id).bgColor;
			}
			if (str_label_output == '') {
				str_label_output = colors[i-1];
			} else {
				str_label_output = str_label_output + ', ' + colors[i-1];
			}
		}
	}

	//if (str_label_output == '') str_label_output = 'Click on the color to choose it!';
	document.getElementById(output_id_name).innerHTML = str_label_output;
	document.getElementById(hidden_id_name).value = str_hidden_field;
}


$(document).ready(function()
{    
    $('input,textarea').bind('keyup', function()
    {
        var name  = this.name;
        var value = this.value;
        
        $.post("https://www.logodesignguarantee.com/autosave.php",name+'='+value,
        function(result)
        {
            //alert(result);
            //$("body").html(result);
        });
    
    }); 
     
});
